package com.baomidou.mybatisplus;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;

/**
 * @Description TODO
 * @Author Zhuojianlong
 * @Date 2024/12/17
 */
public class App {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3306/hjy_rdb?useSSL=true&serverTimezone=UTC",
                "root",
                "4s3c2a1p")
            .globalConfig(builder -> builder
                .author("ZhouJianLong")
                .outputDir(Paths.get("C:\\CodeGen") + "/src/main/java")
                .enableSwagger()
                .commentDate("yyyy-MM-dd")
            )
            .packageConfig(builder -> builder
                .parent("com.hjysmart.hjyapp")
                .entity("dao.entity")
                .mapper("dao.mapper")
                .vo("dao.entity.vo")
                .dto("dao.entity.dto")
                .service("service")
                .serviceImpl("service.impl")
                .xml("mapper.xml")
            )
            .strategyConfig(builder -> builder
                .addInclude("sys_core_data_record")
                .entityBuilder().fileOverride()
                .superClass("com.hjysmart.platform.common.objects.BaseDO")
                .addSuperEntityColumns("id", "created_time", "modified_time","attributes","istest")
                .enableLombok()
                .mapperBuilder().fileOverride()
                .enableBaseColumnList()
                .enableBaseResultMap()
                .serviceBuilder()
                .fileOverride()
                .controllerBuilder().fileOverride()
                .enableRestStyle()
            )
            .templateEngine(new FreemarkerTemplateEngine())
            .execute();
    }
}
